package com.openlogic.common.core.constants.basic;

/**
 * @ClassName: TenantConstants
 * @Description: 租户通用常量
 * @author weiyongpeng
 * @date 2025年1月30日 上午9:33:32
 */
public class TenantConstants {
	
    /** 空用户Id */
    public static final String EMPTY_USER_ID = BaseConstants.NONE_ID;
	
	 /** 空租户Id */
    public static final String EMPTY_TENANT_ID = BaseConstants.NONE_ID;

    /** 公共数据租户Id */
    public static final String COMMON_TENANT_ID = BaseConstants.COMMON_ID;
    
    /** 请求来源 */
    public static final String FROM_SOURCE = "from-source";

    /** 授权信息 */
    public static final String AUTHORIZATION_HEADER = "authorization";
    
    /** 授权信息 */
    public static final String AUTHORIZATION_HEADER_U = "Authorization";

    /** 企业Id */
    public static final String ENTERPRISE_ID = "tenantId";

    /** 企业账号 */
    public static final String ENTERPRISE_NAME = "enterprise_name";

    /** 用户Id */
    public static final String USER_ID = "user_id";

    /** 用户账号 */
    public static final String USER_NAME = "user_name";

    /** 企业类型 */
    public static final String IS_LESSOR = "is_lessor";

    /** 用户类型 */
    public static final String USER_TYPE = "user_type";

    /** 用户标识 */
    public static final String USER_KEY = "user_key";

    /** 租户策略源 */
    public static final String SOURCE_NAME = "source_name";

    /** 登录用户 */
    public static final String LOGIN_USER = "login_user";

    /** 内部请求 */
    public static final String INNER = "inner";

    /** 数据权限 - 创建者 */
    public static final String CREATE_BY = "create_by";

    /** 数据权限 - 更新者 */
    public static final String UPDATE_BY = "update_by";

	/** 租户字段名 */
	public static final String TENANT_ID = "tenant_id";

	/** 公共字段名 */
	public static final String COMMON_ID = "is_common";

	/** 注册租户默认策略Id */
	public static final String REGISTER_TENANT_STRATEGY_ID = BaseConstants.COMMON_ID;

	/** 子库必须数据表 */
	public static final String[] SLAVE_TABLE = { "SYS_DEPT", "SYS_LOGIN_LOG", "SYS_JOB_LOG", "SYS_OPERATE_LOG",
			"SYS_USER_ROLE_MERGE", "SYS_ROLE", "SYS_ROLE_MENU_MERGE", "SYS_ROLE_MODULE_MERGE", "SYS_TENANT_MENU_MERGE",
			"SYS_TENANT_MODULE_MERGE", "SYS_USER" };

	/** 策略源标识 */
	public static final String ISOLATE = "#isolute";

	/** 主数据源标识 */
	public static final String MASTER = "#master";

	/** 手动数据源标识（调用对象中的sourceName属性） */
	public static final String SOURCE = "#sourceName";

	/** 数据源 */
	public enum Source {

		MASTER("master", "默认数据源"), SLAVE("slave", "从数据源"), REGISTER("slave", "注册数据源");

		private final String code;
		private final String info;

		Source(String code, String info) {
			this.code = code;
			this.info = info;
		}

		public String getCode() {
			return code;
		}

		public String getInfo() {
			return info;
		}
	}

	/** 源同步策略类型 */
	public enum SyncType {

		UNCHANGED("0", "不变"), REFRESH("1", "刷新"), ADD("2", "新增"), DELETE("3", "删除");

		private final String code;
		private final String info;

		SyncType(String code, String info) {
			this.code = code;
			this.info = info;
		}

		public String getCode() {
			return code;
		}

		public String getInfo() {
			return info;
		}
	}
}
